/* Copyright(c) 2010- Siro-info Co.(http://www.siro-info.com)
 * All rights reserved.
*/
package com.siro.pm.model.provider;

import com.siro.pm.I18nManager;
import com.vaadin.data.Item;
import com.vaadin.data.util.HierarchicalContainer;
import com.vaadin.terminal.ThemeResource;

/**
 * Class Declaration:
 *
 *@version v1.0
 *@since AttendanceTreeProvider.java v1.0
 */
public class AttendanceTreeProvider {
	public static String ATTENDANCE_PROPERTY_NAME = "name";
	public static String ATTENDANCE_PROPERTY_ICON = "icon";

	public static String ATTENDANCE_ITEM_INVOICE = "invoice";
	public static String ATTENDANCE_ITEM_ATTENDANCE = "attendance ";

	static HierarchicalContainer attendanceTreeContainer;
	static {
		attendanceTreeContainer = new HierarchicalContainer();
		attendanceTreeContainer.addContainerProperty(ATTENDANCE_PROPERTY_NAME,
				String.class, null);
		attendanceTreeContainer.addContainerProperty(ATTENDANCE_PROPERTY_ICON,
				ThemeResource.class, new ThemeResource(
						"../siropm/img/folder.gif"));
	}

	public static HierarchicalContainer getAttendanceTreeContainer() {
		attendanceTreeContainer.removeAllItems();
		// attendance
		Item item_attendance = attendanceTreeContainer.addItem(ATTENDANCE_ITEM_ATTENDANCE);
		item_attendance.getItemProperty(ATTENDANCE_PROPERTY_NAME).setValue(
				I18nManager.getMessage("attendanceview.attendance"));
		item_attendance.getItemProperty(ATTENDANCE_PROPERTY_ICON).setValue(
				new ThemeResource("../siropm/img/attendance.png"));
		attendanceTreeContainer.setChildrenAllowed(ATTENDANCE_ITEM_ATTENDANCE, false);
		// invoice
		Item item_modifypwd = attendanceTreeContainer.addItem(ATTENDANCE_ITEM_INVOICE);
		item_modifypwd.getItemProperty(ATTENDANCE_PROPERTY_NAME).setValue(
				I18nManager.getMessage("attendanceview.invoice"));
		item_modifypwd.getItemProperty(ATTENDANCE_PROPERTY_ICON).setValue(
				new ThemeResource("../siropm/img/invoice.png"));
		attendanceTreeContainer.setChildrenAllowed(ATTENDANCE_ITEM_INVOICE, false);
		
		return attendanceTreeContainer;
	}

}
